import request from "../index";
import { version } from "@/config";

// 上传图片 
export function myUploadUrl() {
  return process.env.baseUrl + `/ssop/api/cms-v${version}/file/upload`
}

/*
*  我的订单
*/

// 我的订单列表
export function myOrderList({
  pageNo = 1,
  pageSize = 10,
  status = "10,11,20,21,31,40,50,51,52,60,70"
}) {
  const data = {
      pageNo,
      pageSize,
      status
  };
  if(status == 60){
    data.isComment = 0
  }
  return request({
    url: `ssop/api/order-v${version}/refactor/applet/order/list`,
    method: "post",
    data,
  })
}

// 订单详情
export function myOrderDetail(orderId) {
  return request({
    url: `/ssop/api/order-v${version}/refactor/applet/order/info?orderId=${orderId}`,
    method: "get",
  })
}

// 取消订单，原因列表
export function myOrderCancelReason(id) {
  return request({
    url: `/ssop/api/cms-v${version}/applet/order/qa/cause/list?id=${id}`,
    method: "get",
  })
}

// 取消订单
export function myOrderCancel(params) {
  return request({
    url: `/ssop/api/order-v${version}/cancel/unpaid`,
    method: "post",
    data: params
  })
}

/*
*  添加评论
*/

// 提交评论
export function myCommentSubmit(params) {
  return request({
      url: `/ssop/api/order-v${version}/applets/evaluate/save`,
      method: "post",
      data: params
  })
}

/*
*  意见反馈
*/

// 反馈类型 
export function myFeedbackType() {
  return request({
      url: `/ssop/api/cms-v${version}/applet/feedBack/query/type`,
      method: "post",
  })
}

// 提交反馈
export function myFeedbackSubmit(params) {
  return request({
      url: `/ssop/api/cms-v${version}/applet/feedBack/add`,
      method: "post",
      data: params
  })
}

// 提交个人信息 
export function myInfoSubmit(data) {
  return request({
      url: `/ssop/api/member-v${version}/member/change`,
      method: "post",
      data,
      headers: {
        "Content-Type'":"application/x-www-form-urlencoded"
      }
  })
}
